<h2>Dashboard</h2>

<% if @inbox.size > 0 %>
<h3><img src="/images/letter.png" align="left">Inbox</h3>
<ul>
<%= render(:partial=>'task/task', :collection=>@inbox, :locals=>{:tasks=>@inbox, :item_name=>'inbox'}) %>
</ul>
<% end %>
 
<% if @invit!=[] %>
<h3><img src="/images/letter.png" align="left">Invitations</h3>

<% for i in @invit %>
<div id="inv<%=i.id%>">
<%=i.name%> invites you to join the project "<%=i.project.name%>"
<%= link_to_remote( "Accept", {:update => "inv"+i.id.to_s, :url =>{ :controller=> :invitation, :action => :accept, :id=>i.id },
 :loading  => visual_effect('appear', 'ind'+i.id.to_s),
 :success => {visual_effect('fade', 'ind'+i.id.to_s), visual_effect('fade','ind'+i.id.to_s)}},
 {:class=>"btnlnk"}) %>
<%= link_to_remote( "Decline", {:update => "inv"+i.id.to_s, :url =>{ :controller=> :invitation, :action => :decline, :id=>i.id },
 :loading  => visual_effect('appear', 'ind'+i.id.to_s),
 :success => {visual_effect('fade', 'ind'+i.id.to_s), visual_effect('fade','ind'+i.id.to_s)}},
 {:class=>"btnlnk"}) %>

<img id="ind<%=i.id%>" src="/images/loading.gif" style="display:none;">

</div>
<% end %>
<% end %>


<% if @projects.size == 0 or @user.tasks.size == 0-%>
Welcome.<br/>
You can now keep track of the tasks you have to do. They will belong to categories called "projects".<br/>
Each project can have its own group of users.<br/>
<br/>
Create a task now by clicking on tasks, in the menu above.<br/>

<% else -%>

<% if @deadlines.size>0 -%>
<h3><img src="/images/time2.png" align="left">Deadlines</h3>
<div id="deadlines_content">
<%= render(:partial=>'task/deadline_tasks', :locals=>{:deadlines=>@deadlines, :tasks=>@tasks}) %>
</div>
<% end -%>

<% if @deadlines.size>0 || @calendar.size>0 -%>
<h3><img src="/images/time2.png" align="left">Calendar</h3>
<ul>
<%= render(:partial=>'calendar/event', :collection=>@calendar) %>
</ul>
<% end -%>

<!--
<h3><img src="/images/important.png" align="left">Important tasks</h3>
<%# if @important_tasks.size==0 -%>
You have no tasks.
<%# else -%>
<ul>
<%# render(:partial=>'task/task', :collection=>@important_tasks, :locals=>{:tasks=>@important_tasks, :item_name=>'it'}) %>
</ul>
<%# end -%>
-->

<% if @tasksdone1.size+@tasksdone2.size > 0-%>
<h3>Tasks done by others</h3>
<ul>

<% if @tasksdone1.size > 0-%>
<li>
<b>Today and yesterday</b>
<ul style="list-style-type:none;padding:0;font-size:small;">
<%= render(:partial=>'project/task', :collection=>@tasksdone1) %>
</ul>
</li>
<% end -%>

<% if @tasksdone2.size > 0-%>
<li>
<b>Last week</b>
<ul style="list-style-type:none;padding:0;font-size:small;">
<%= render(:partial=>'project/task', :collection=>@tasksdone2) %>
</ul>
</li>
</ul>
<% end -%>
<% end -%>

<%
end # if one project exists
-%>
